import { requestClient } from '../request';
export namespace userApi {
  export interface listItem {
    createTime: string;
    id: string;
    avatarUrl: string;
    phone: string;
    nickName: string;
    isAdmin: number;
  }
  export interface getUserListResult {
    code: number;
    message: string;
    data: {
      total: string;
      list: listItem[];
    };
  }
  export interface baseResult {
    code: number;
    message: string;
    data: string;
  }
}

/**
 * 获取用户列表
 */
export async function getUserList(params: {
  phone?: string;
  pageNum: number;
  pageSize: number;
}) {
  return requestClient.get<userApi.getUserListResult>(
    '/basic/appUser/getAppUserPage',
    { params },
  );
}
// 设置用户角色为管理员
export async function setUserRole(data: { id: string }) {
  return requestClient.post<userApi.baseResult>(
    '/basic/appUser/setWhetherAppUserIsAdmin',
    data,
  );
}
